package com.example.time_manage_web.controller;

import com.example.time_manage_web.pojo.User;
import com.example.time_manage_web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @BelongsProject: time_manage_web
 * @BelongsPackage: com.example.time_manage_web.controller
 * @Author: fox
 * @CreateTime: 2023-04-09  16:49
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public int login(User user) {
       int a = this.userService.login(user);
        return a;
    }
    @PostMapping("/register")
    public int add(User user) {
        int a = this.userService.add(user);
        return a;
    }
    @PostMapping("/up")
    public int up(User user) {
        int a = this.userService.up(user);
        return a;
    }
    @PostMapping("/quhead")
    public List<User> quhead(User user) {
        return this.userService.quhead(user);
    }
    @PostMapping("/nick")
    public String nick(User user) {
        return this.userService.nick(user);
    }
    @PostMapping("/username")
    public String username(User user) {
        return this.userService.username(user);
    }
    @PostMapping("/password")
    public String password(User user) {
        return this.userService.password(user);
    }
    @GetMapping("/queryuser")
    public List<User> query(){
        return this.userService.query();
    }

}
